#pragma once
#include <vector>

#include <d3d11.h>
#include <DirectXMath.h>
#include <d3dcompiler.h>

#include "IComponent.h"
#include "IRenderable.h"
#include "IVertexType.h"
#include "IEffect.h"
#include "Position3NormalColor.h"

using namespace DirectX;
using namespace std;

class EffectPosition3NormalColor : virtual public IComponent, public IRenderable, public IEffect, public Position3NormalColor
{
public:
	EffectPosition3NormalColor(void);
	~EffectPosition3NormalColor(void);

	virtual void Initialize(HWND WindowHandle = nullptr, HINSTANCE hInstance = nullptr, ID3D11Device* Device = nullptr, ID3D11DeviceContext* DeviceContext = nullptr);
	virtual void Update(int DeltaTime);
	virtual void Shutdown();
	virtual void Render();

	void AddVertex(Position3NormalColor Vertex);
	void Create();

	ID3D11Buffer* GetConstantBuffer();

private:
	void CompileShaderFromFile( WCHAR* szFileName, LPCSTR szEntryPoint, LPCSTR szShaderModel, ID3DBlob** ppBlobOut );

	ID3D11Device *D3DDevice;
	ID3D11DeviceContext *D3DDeviceContext;
	ID3D11Buffer* VertexBuffer;
	ID3D11Buffer *ConstantBuffer;
	ID3D11PixelShader *PixelShader;
	ID3D11VertexShader *VertexShader;
	ID3D11InputLayout *VertexLayout;
	
	vector<Position3NormalColor> Vertices;
};

